package test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import shared.Buffer;

import bubbleSort.BubbleSortManagerSequential;

public class BubbleSortSequential {
	@Test
	public void test1(){
		final BubbleSortManagerSequential<Integer> manager = new BubbleSortManagerSequential<Integer>(); 
		final Buffer<Integer> buffer = new Buffer<Integer>();
		final Buffer<Integer> outputBuffer = manager.sort(buffer);
		assertTrue(outputBuffer.isEmpty());
	}
	
	@Test
	public void test2(){
		final BubbleSortManagerSequential<Integer> manager = new BubbleSortManagerSequential<Integer>(); 
		final Buffer<Integer> buffer = new Buffer<Integer>();
		buffer.put(0);
		final Buffer<Integer> outputBuffer = manager.sort(buffer);
		assertFalse(outputBuffer.isEmpty());
		assertEquals(new Integer(0),outputBuffer.get());
		
	}
	
	@Test
	public void test3(){
		final BubbleSortManagerSequential<Integer> manager = new BubbleSortManagerSequential<Integer>(); 
		final Buffer<Integer> buffer = new Buffer<Integer>();
		buffer.put(0);
		buffer.put(1);
		final Buffer<Integer> outputBuffer = manager.sort(buffer);
		assertFalse(outputBuffer.isEmpty());
		assertEquals(new Integer(0),outputBuffer.get());
		assertEquals(new Integer(1),outputBuffer.get());
		
	}
	@Test
	public void test4(){
		final BubbleSortManagerSequential<Integer> manager = new BubbleSortManagerSequential<Integer>(); 
		final Buffer<Integer> buffer = new Buffer<Integer>();
		buffer.put(1);
		buffer.put(0);
		final Buffer<Integer> outputBuffer = manager.sort(buffer);
		assertFalse(outputBuffer.isEmpty());
		assertEquals(new Integer(0),outputBuffer.get());
		assertEquals(new Integer(1),outputBuffer.get());
		
	}
	@Test
	public void test5(){
		final BubbleSortManagerSequential<Integer> manager = new BubbleSortManagerSequential<Integer>(); 
		final Buffer<Integer> buffer = new Buffer<Integer>();
		buffer.put(0);
		buffer.put(1);
		buffer.put(2);
		final Buffer<Integer> outputBuffer = manager.sort(buffer);
		assertFalse(outputBuffer.isEmpty());
		assertEquals(new Integer(0),outputBuffer.get());
		assertEquals(new Integer(1),outputBuffer.get());
		assertEquals(new Integer(2),outputBuffer.get());
		
	}
	@Test
	public void test6(){
		final BubbleSortManagerSequential<Integer> manager = new BubbleSortManagerSequential<Integer>(); 
		final Buffer<Integer> buffer = new Buffer<Integer>();
		buffer.put(2);
		buffer.put(1);
		buffer.put(0);
		final Buffer<Integer> outputBuffer = manager.sort(buffer);
		assertFalse(outputBuffer.isEmpty());
		assertEquals(new Integer(0),outputBuffer.get());
		assertEquals(new Integer(1),outputBuffer.get());
		assertEquals(new Integer(2),outputBuffer.get());
	}
	@Test
	public void test7(){
		final BubbleSortManagerSequential<Integer> manager = new BubbleSortManagerSequential<Integer>(); 
		final Buffer<Integer> buffer = new Buffer<Integer>();
		buffer.put(1);
		buffer.put(2);
		buffer.put(0);
		final Buffer<Integer> outputBuffer = manager.sort(buffer);
		assertFalse(outputBuffer.isEmpty());
		assertEquals(new Integer(0),outputBuffer.get());
		assertEquals(new Integer(1),outputBuffer.get());
		assertEquals(new Integer(2),outputBuffer.get());
	}
	@Test
	public void test8(){
		final BubbleSortManagerSequential<Integer> manager = new BubbleSortManagerSequential<Integer>(); 
		final Buffer<Integer> buffer = new Buffer<Integer>();
		buffer.put(4);
		buffer.put(6);
		buffer.put(3);
		buffer.put(5);
		buffer.put(8);
		buffer.put(0);
		buffer.put(2);
		buffer.put(9);
		buffer.put(7);
		buffer.put(1);
		final Buffer<Integer> outputBuffer = manager.sort(buffer);
		assertFalse(outputBuffer.isEmpty());
		assertEquals(new Integer(0),outputBuffer.get());
		assertEquals(new Integer(1),outputBuffer.get());
		assertEquals(new Integer(2),outputBuffer.get());
		assertEquals(new Integer(3),outputBuffer.get());
		assertEquals(new Integer(4),outputBuffer.get());
		assertEquals(new Integer(5),outputBuffer.get());
		assertEquals(new Integer(6),outputBuffer.get());
		assertEquals(new Integer(7),outputBuffer.get());
		assertEquals(new Integer(8),outputBuffer.get());
		assertEquals(new Integer(9),outputBuffer.get());
	}
}
